package com.kuang.controller;

import com.kuang.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@RestController
public class ControllerAjax {


    @RequestMapping("/t1")
    public String Ajax(){
        return "Hello";
    }


    @RequestMapping("/a1")
    public void a1(String name, HttpServletResponse response) throws IOException {
        System.out.println("param" + name);
        if (name.equals("yutao")){
            response.getWriter().println("true");
            response.getWriter().println("true");
        }else {
            response.getWriter().println("false");
        }
    }

    @RequestMapping("/t2")
    public List<User> Test1(){
        List<User> userList = new ArrayList<>();
        userList.add(new User("1","段宝宝","女",18));
        userList.add(new User("2","余帅哥","女",21));

        return userList;
    }

}
